<?php
namespace Tbf\Bundle\TestBundle\SetUp;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Tbf\Bundle\DatabaseBundle\SetTableData\SetTableData;

class DbSetup implements SetupInterface{
    protected $deps;
    protected $db_data;
    function __construct($db_data){
        $this->db_data = $db_data;
    }

    /**
     * @return array string[]
     */
    function getDeps()
    {
        return $this->deps;
    }

    function setDeps($deps){
        $this->deps = $deps;
    }

    /**
     * @return void
     */
    function doSetUp(ContainerInterface $container)
    {
        $container->get('tbf_database.set_table_data')->setTableData($this->db_data);

    }

    /**
     * @param array
     * @return SetupInterface
     */
    static function newFromArray(array $config)
    {
        $obj = new DbSetup($config['db_data']);
        if (!empty($config['deps'])){
            $obj->setDeps($config['deps']);
        }
        return $obj;
    }
}